/*
Replication Files for 
"The power of relative performance information in public communication"

*/

**# Bookmark #1

//*******************Survey 1***************//
********Call Database
cd C:\Users\Administrator\Desktop\dataverse_files //Insert File Directory
use Survey1.dta,clear

***Variable Encoding
gen gender=.
replace gender=0 if Q1=="男"
replace gender=1 if Q1=="女"
label def lab_gen 0 "male"  1 "female"
label values gender lab_gen

gen age=. 
replace age=1 if Q2=="0-20岁"
replace age=2 if Q2=="21-30岁"
replace age=3 if Q2=="31-40岁"
replace age=4 if Q2=="41-50岁"
replace age=5 if Q2=="51-60岁"
replace age=6 if Q2=="60岁以上"
label def lab_age 1 "0-20"  2 "21-30" 3 "31-40" 4 "41-50" 5 "51-60" 6 "over 60"
label value age lab_age

gen job=.
replace job=1 if Q3=="全日制学生"
replace job=2 if Q3=="党政机关"
replace job=3 if Q3=="事业单位"
replace job=4 if Q3=="国有企业"
replace job=5 if Q3=="私营企业"
replace job=6 if Q3=="外资企业"
replace job=7 if Q3=="个体工商户"
replace job=8 if Q3=="务农"
replace job=9 if Q3=="自由职业【提示：如作家、股票投资】"
replace job=10 if Q3=="无业"
replace job=11 if Q3=="其他"
label def lab_job 1"students"  2"government"  3"public agencies" 4"state-owned" 5"private enterprises" ///
6"foreign enterprises" 7"individual business" 8"farmers" 9"freelance" 10"jobless" 11"others"
label value job lab_job

gen political=.
replace political=1 if Q4=="群众"
replace political=2 if Q4=="共青团员"
replace political=3 if Q4=="中共党员"
replace political=4 if Q4=="民主党派"
label def lab_poli 1"the mass" 2"league member" 3"CCP" 4 "democratic"
label values  political lab_poli
  
gen edu=. 
replace edu=1 if Q5=="小学及以下"
replace edu=2 if Q5=="初中"
replace edu=3 if Q5=="高中（含中专）"
replace edu=4 if Q5=="大专"
replace edu=5 if Q5=="大学本科"
replace edu=6 if Q5=="硕士及以上"
label def lab_edu 1"primary school or below" 2"junior high school" 3"senior high school" ///
4"junior college" 5 "undergraduate" 6"mater degree or above"
label values edu lab_edu

gen location=.
replace location=1 if Q6=="农业户口"
replace location=0 if Q6=="城镇户口"
label def lab_loc 1"rural" 0"urban"
label values location lab_loc

gen income=.
replace income=1 if Q7=="5000元以下"
replace income=2 if Q7=="5000-9999元"
replace income=3 if Q7=="10,000-19,999元"
replace income=4 if Q7=="20,000-29,999元"
replace income=5 if Q7=="30,000-39,999元"
replace income=6 if Q7=="40,000-49,999元"
replace income=7 if Q7=="50,000-59,999元"
replace income=8 if Q7=="60,000-79,999元"
replace income=9 if Q7=="80,000-99,999元"
replace income=10 if Q7=="100,000-119,999元"
replace income=11 if Q7=="120,000-139,999元"
replace income=12 if Q7=="140,000-159,999元"
replace income=13 if Q7=="160,000-179,000元"
replace income=14 if Q7=="180,000-199,999元"
replace income=15 if Q7=="20万以上"
label def lab_inc 1"<5000" 2"5000-9999" 3"10,000-19,999" 4"20,000-29,999" 5"30,000-39,999" 6"40,000-49,999" ///
7"50,000-59,999" 8"60,000-79,999" 9"80,000-99,999" 10"100,000-119,999" 11"120,000-139,999" /// 
12"140,000-159,999" 13"160,000-179,000" 14"180,000-199,999" 15">200,000"
label values income lab_inc

gen support_1=.
replace support_1=1 if Q3_1=="非常不同意"
replace support_1=2 if Q3_1=="不太同意"
replace support_1=3 if Q3_1=="说不清"
replace support_1=4 if Q3_1=="比较同意"
replace support_1=5 if Q3_1=="非常同意"

gen support_2=. 
replace support_2=1 if Q3_2=="非常不同意"
replace support_2=2 if Q3_2=="不太同意"
replace support_2=3 if Q3_2=="说不清"
replace support_2=4 if Q3_2=="比较同意"
replace support_2=5 if Q3_2=="非常同意"

egen support =rowtotal(support_?)


gen nation_1=.
replace nation_1=1 if Q4_1=="非常不同意"
replace nation_1=2 if Q4_1=="不同意"
replace nation_1=3 if Q4_1=="说不清"
replace nation_1=4 if Q4_1=="同意"
replace nation_1=5 if Q4_1=="非常同意"

gen nation_2=.
replace nation_2=1 if Q4_2=="非常不同意"
replace nation_2=2 if Q4_2=="不同意"
replace nation_2=3 if Q4_2=="说不清"
replace nation_2=4 if Q4_2=="同意"
replace nation_2=5 if Q4_2=="非常同意"

egen nation =rowtotal (nation_?) 


destring Q2_? ,replace
egen infor=rowtotal(Q2_?)

gen treat=.
replace treat=1 if group=="竞争性信息控制组"  
replace treat=2 if group=="竞争性信息实验组1" 
replace treat=3 if group=="竞争性信息实验组2" 
replace treat=4 if group=="竞争性信息实验组3" 

gen relative=. 
replace relative=1 if treat==2|treat==3
replace relative=0 if treat==1|treat==4

gen negative=. 
replace negative=1 if treat==2|treat==4
replace negative=0 if treat==1|treat==3

drop group Q3_1 Q3_2 Q4_1 Q4_2 Q2_1 Q2_2 Q2_3 Q2_4 Q1 Q2 Q3 Q4 Q5 Q6 Q7 


****************** Survey1  Manuscript ***************

*Table1--OLS regression
reg infor i.negative i.relative 
reg infor i.negative##i.relative


*Figure4
sdtest infor if negative==0 ,by(relative) 
ttest  infor if negative==0 ,by(relative) reverse unequal
sdtest infor if negative==1 ,by(relative)
ttest  infor if negative==1 ,by(relative) reverse unequal

label define lab_neg 0"without negative information" 1"with negative information"
label values negative lab_neg
label define lab_rela 0 "without relative information" 1"with relative information"
label values relative lab_rela

sum infor if negative==0 & relative==0
sum infor if negative==0 & relative==1
sum infor if negative==1 & relative==0
sum infor if negative==1 & relative==1

catcibar infor ,over(relative) by(negative) legend(position(6) rows(3)) ///
ytitle("Rating of pandemic response(mean)",size(mlarge)) wrapxlab(3) xlabel(none,noticks) xscale(off) ///
xsize(5) ysize(4) ///
xtitle(n=218		 ///
n=216		 ///
n=219		 ///
n=217) scheme(s1mono) 



*******************  Survey1  Appendix *******
*Table A1-Descriptive Statistics
tab gender
tab age
tab job 
tab political
tab edu
tab location
tab income

*Table A4--Balance Test
cap erase "bal_1.txt"
cap erase "bal_1.xml"
global covar= "gender edu job income age location political"
qui foreach var of varlist $covar {
	reg `var' i.treat, r
	test 2.treat 3.treat 4.treat
	outreg2 using "bal_1.xml", excel dec(2) addstat(F test, e(p)) 
}


**# Bookmark #2
//*******************Survey2**********************//
*****Call Database
use Survey2.dta,clear

*****Variable Encoding
gen gender=.
replace gender=0 if Q1=="男"
replace gender=1 if Q1=="女"
label def lab_gen 0 "male"  1 "female"
label values gender lab_gen

gen age=. 
replace age=1 if Q2=="0-20岁"
replace age=2 if Q2=="21-30岁"
replace age=3 if Q2=="31-40岁"
replace age=4 if Q2=="41-50岁"
replace age=5 if Q2=="51-60岁"
replace age=6 if Q2=="60岁以上"
label def lab_age 1 "0-20"  2 "21-30" 3 "31-40" 4 "41-50" 5 "51-60" 6 "over 60"
label value age lab_age

gen job=.
replace job=1 if Q3=="全日制学生"
replace job=2 if Q3=="党政机关"
replace job=3 if Q3=="事业单位"
replace job=4 if Q3=="国有企业"
replace job=5 if Q3=="私营企业"
replace job=6 if Q3=="外资企业"
replace job=7 if Q3=="个体工商户"
replace job=8 if Q3=="务农"
replace job=9 if Q3=="自由职业【提示：如作家、股票投资】"
replace job=10 if Q3=="无业"
replace job=11 if Q3=="其他"
label def lab_job 1"students"  2"government"  3"public agencies" 4"state-owned" 5"private enterprises" ///
6"foreign enterprises" 7"individual business" 8"farmers" 9"freelance" 10"jobless" 11"others"
label value job lab_job

gen political=.
replace political=1 if Q4=="群众"
replace political=2 if Q4=="共青团员"
replace political=3 if Q4=="中共党员"
replace political=4 if Q4=="民主党派"
label def lab_poli 1"the mass" 2"league member" 3"CCP" 4 "democratic"
label values  political lab_poli
  
gen edu=. 
replace edu=1 if Q5=="小学及以下"
replace edu=2 if Q5=="初中"
replace edu=3 if Q5=="高中（含中专）"
replace edu=4 if Q5=="大专"
replace edu=5 if Q5=="大学本科"
replace edu=6 if Q5=="硕士及以上"
label def lab_edu 1"primary school or below" 2"junior high school" 3"senior high school" ///
4"junior college" 5 "undergraduate" 6"mater degree or above"
label values edu lab_edu

gen location=.
replace location=1 if Q6=="农业户口"
replace location=0 if Q6=="城镇户口"
label def lab_loc 1"rural" 0"urban"
label values location lab_loc

gen income=.
replace income=1 if Q7=="5000元以下"
replace income=2 if Q7=="5000-9999元"
replace income=3 if Q7=="10,000-19,999元"
replace income=4 if Q7=="20,000-29,999元"
replace income=5 if Q7=="30,000-39,999元"
replace income=6 if Q7=="40,000-49,999元"
replace income=7 if Q7=="50,000-59,999元"
replace income=8 if Q7=="60,000-79,999元"
replace income=9 if Q7=="80,000-99,999元"
replace income=10 if Q7=="100,000-119,999元"
replace income=11 if Q7=="120,000-139,999元"
replace income=12 if Q7=="140,000-159,999元"
replace income=13 if Q7=="160,000-179,000元"
replace income=14 if Q7=="180,000-199,999元"
replace income=15 if Q7=="20万以上"
label def lab_inc 1"<5000" 2"5000-9999" 3"10,000-19,999" 4"20,000-29,999" 5"30,000-39,999" 6"40,000-49,999" ///
7"50,000-59,999" 8"60,000-79,999" 9"80,000-99,999" 10"100,000-119,999" 11"120,000-139,999" /// 
12"140,000-159,999" 13"160,000-179,000" 14"180,000-199,999" 15">200,000"
label values income lab_inc

destring Q1_?,replace
egen infor=rsum(Q1_?)
 
gen treat_group=.
replace treat_group=1 if group=="无比较控制组"
replace treat_group=2 if group=="无比较正面披露"
replace treat_group=3 if group=="无比较反向披露"
replace treat_group=4 if group=="有比较控制组"
replace treat_group=5 if group=="有比较正向披露"
replace treat_group=6 if group=="有比较反向披露"

gen treat=.
replace treat=1 if treat_group==1|treat_group==4 
replace treat=2 if treat_group==2|treat_group==5 
replace treat=3 if treat_group==3|treat_group==6 
label def lab_treat 1 "baseline" 2 "positive" 3 "negative"
label values treat lab_treat

gen relative=.
replace relative=0 if treat_group==1|treat_group==2|treat_group==3 
replace relative=1 if treat_group==4|treat_group==5|treat_group==6

gen guess=.
replace guess=1 if regexm(Q2_1,"答题者评价中国经济表现的时候，是否受到了中国相比于其他国家的表现的影响")
replace guess=0 if guess==.

drop Q1 Q2 Q3 Q4 Q5 Q6 Q7


****** Survey2 Manuscript ******

*Table2
reg infor i.relative i.treat
reg infor i.relative##i.treat


*Figure5
reg infor i.relative##i.treat
coefplot ,drop(_cons 1.relative 2.treat 3.treat) xline(0, lp(dash) lcolor(gs10)) ///
ciopts(recast(rcap) lc(black)) mcolor(black) ms(S) graphregion(color(white)) ///
yscale( axis(1) lcolor(none)) ylabel(1 "Positive Effect" 2"Negative Effect", ///
nogrid noticks labsize(large)) ysize(1) xsize(1) scheme(lean1)


*Figure6
reg guess i.treat
coefplot ,drop(_cons) xline(0, lp(dash) lcolor(gs10)) ///
ciopts(recast(rcap) lc(black)) mcolor(black) ms(S) graphregion(color(white)) ///
yscale(axis(1) lcolor(none)) ylabel(, nogrid noticks labsize(large)) ysize(1) xsize(1) scheme(lean1)



****** Survey2 Appendix *******

*Table A2--Descriptive Statistics
tab gender
tab age
tab job 
tab political
tab edu
tab location
tab income

*Table A5--Balance Test
cap erase "bal_2.txt"
cap erase "bal_2.xml"
global covar = "gender edu job income age location political"
qui foreach var of varlist $covar {
	reg `var' i.treat_group, r
	test 2.treat_group 3.treat_group 4.treat_group 5.treat_group 6.treat_group
	outreg2 using "bal_2.xml", excel dec(2) addstat(F test, e(p))
}



**# Bookmark #3
//*******************Survey3**********************//

*****Call Database
use Survey3.dta,clear

*****Variable Encoding
gen gender=.
replace gender=0 if Q1=="男"
replace gender=1 if Q1=="女"
label def lab_gen 0 "male"  1 "female"
label values gender lab_gen

rename Q2 age
destring age,replace

gen job=.
replace job=1 if Q3=="全日制学生"
replace job=2 if Q3=="党政机关"
replace job=3 if Q3=="事业单位"
replace job=4 if Q3=="国有企业"
replace job=5 if Q3=="私营企业"
replace job=6 if Q3=="外资企业"
replace job=7 if Q3=="个体工商户"
replace job=8 if Q3=="务农"
replace job=9 if Q3=="自由职业【提示：如作家、股票投资】"
replace job=10 if Q3=="无业"
replace job=11 if Q3=="其他"
label def lab_job 1"students"  2"government"  3"public agencies" 4"state-owned" 5"private enterprises" ///
6"foreign enterprises" 7"individual business" 8"farmers" 9"freelance" 10"jobless" 11"others"
label value job lab_job

gen political=.
replace political=1 if Q4=="群众"
replace political=2 if Q4=="共青团员"
replace political=3 if Q4=="中共党员"
replace political=4 if Q4=="民主党派"
label def lab_poli 1"the mass" 2"league member" 3"CCP" 4 "democratic"
label values  political lab_poli
  
gen edu=. 
replace edu=1 if Q5=="小学及以下"
replace edu=2 if Q5=="初中"
replace edu=3 if Q5=="高中（含中专）"
replace edu=4 if Q5=="大专"
replace edu=5 if Q5=="大学本科"
replace edu=6 if Q5=="硕士及以上"
label def lab_edu 1"primary school or below" 2"junior high school" 3"senior high school" ///
4"junior college" 5 "undergraduate" 6"mater degree or above"
label values edu lab_edu

gen location=.
replace location=1 if Q6=="农业户口"
replace location=0 if Q6=="城镇户口"
label def lab_loc 1"rural" 0"urban"
label values location lab_loc

gen income=.
replace income=1 if Q7=="5000元以下"
replace income=2 if Q7=="5000-9999元"
replace income=3 if Q7=="10,000-19,999元"
replace income=4 if Q7=="20,000-29,999元"
replace income=5 if Q7=="30,000-39,999元"
replace income=6 if Q7=="40,000-49,999元"
replace income=7 if Q7=="50,000-59,999元"
replace income=8 if Q7=="60,000-79,999元"
replace income=9 if Q7=="80,000-99,999元"
replace income=10 if Q7=="100,000-119,999元"
replace income=11 if Q7=="120,000-139,999元"
replace income=12 if Q7=="140,000-159,999元"
replace income=13 if Q7=="160,000-179,000元"
replace income=14 if Q7=="180,000-199,999元"
replace income=15 if Q7=="20万以上"
label def lab_inc 1"<5000" 2"5000-9999" 3"10,000-19,999" 4"20,000-29,999" 5"30,000-39,999" 6"40,000-49,999" ///
7"50,000-59,999" 8"60,000-79,999" 9"80,000-99,999" 10"100,000-119,999" 11"120,000-139,999" /// 
12"140,000-159,999" 13"160,000-179,000" 14"180,000-199,999" 15">200,000"
label values income lab_inc

destring Q1_?,replace
egen infor=rsum(Q1_?)

gen treat=.
replace treat=1 if group=="无横向比较+无纵向比较"
replace treat=2 if group=="无横向比较+有纵向比较"
replace treat=3 if group=="无纵向比较+有横向比较"
replace treat=4 if group=="有纵向比较+有横向比较"


gen relative=.
replace relative=0 if treat==1 | treat==2
replace relative=1 if treat==3 | treat==4

gen negative=.
replace negative=0 if treat==1 | treat==3
replace negative=1 if treat==2 | treat==4

gen correct1=.
replace correct1=1 if treat==1 & Q0=="材料中没有相关的信息"
replace correct1=1 if treat==2 & Q0=="GDP增速逐年下降"
replace correct1=1 if treat==3 & Q0=="材料中没有相关的信息"
replace correct1=1 if treat==4 & Q0=="GDP增速逐年下降"
replace correct1=0 if correct1==.

destring Q3_?,replace
gen correct2=.
replace correct2=1 if treat==1 & Q3_1==1 & Q3_2==0 & Q3_3==0 & Q3_4==0
replace correct2=1 if treat==2 & Q3_1==1 & Q3_2==0 & Q3_3==0 & Q3_4==0
replace correct2=1 if treat==3 & Q3_1==1 & Q3_2==1 & Q3_3==1 & Q3_4==1
replace correct2=1 if treat==4 & Q3_1==1 & Q3_2==1 & Q3_3==1 & Q3_4==1
replace correct2=0 if correct2==.

gen correct=.
replace correct=1 if correct1==1 & correct2==1
replace correct=0 if correct==.

****** Survey3 Manuscript ******

*Table3 
reg infor i.negative i.relative
reg infor i.negative##i.relative


*Figure7
sdtest infor if negative==0,by(relative)
ttest infor if negative==0,by(relative) unequal reverse
sdtest infor if negative==1,by(relative)
ttest infor if negative==1,by(relative) unequal reverse

sum infor if negative==0 & relative==0
sum infor if negative==0 & relative==1
sum infor if negative==1 & relative==0
sum infor if negative==1 & relative==1
label define lab_neg 0"without negative information" 1"with negative information"
label values negative lab_neg
label define lab_rela 0 "without relative information" 1"with relative information"
label values relative lab_rela
catcibar infor ,over(relative) by(negative) legend(position(6) rows(3)) ///
ytitle("Rating of economic performance(mean)",size(medlarge)) wrapxlab(3) ///
xlabel(none,noticks) xscale(off) xtick(,noticks) xsize(5) ysize(4) ///
xtitle(n=264		 ///
n=262			 ///
n=262			 ///
n=262) scheme(s1mono) 


******Survey3 Appendix****

*Table A3--Descriptive Statistics
tab gender
sum age
tab job 
tab political
tab edu
tab location
tab income

*Table A6--Balance Test
cap erase "bal_3.txt"
cap erase "bal_3.xml"
global covar = "gender edu job income age location political"
qui foreach var of varlist $covar {
	reg `var' i.treat, r
	test 2.treat 3.treat 4.treat
	outreg2 using "bal_3.xml", excel dec(2) addstat(F test, e(p))
}
